//该文件用于创建整个应用的路由器
import VueRouter from "vue-router"

import About from '../pages/About.vue'
import Home from '../pages/Home.vue'
import News from '../pages/News.vue'
import Message from '../pages/Message.vue'

//创建并暴露一个路由器
export default new VueRouter({
    routes: [ //配置每一组路由规则
        {
            path: '/about', //一级路由 路径
            component: About, //路径所展示的组件实例
        },
        {
            path: '/home',
            component: Home,
            children: [ //在Home组件内配置子路由（二级路由）
                {
                    path: 'news', //子路由不需要再加/，vue遍历路由时会自动拼接
                    component: News,
                },
                {
                    path: 'message',
                    component: Message,
                }
            ]
        },
    ]
})